<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div class="container">
        <div>这是之前的 div</div>

        <button>删除新 div</button>
    </div>

    <script>
        let div = document.createElement('div');
        div.innerHTML = '这是新的 div';
        div.id = 'one';
        div.className = 'one-div';
        div.style.fontSize = '30px';

        console.log(div);

        let container = document.querySelector('.container');
        container.appendChild(div);

        let button = document.querySelector('button');
        button.onclick = function() {
            container.removeChild(div);
        }
    </script>

</body>
</html>